<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"emoh.xyz","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="插件相关   快捷键 说明    , Leader Key   &lt;leader&gt;n 打开&#x2F;关闭代码资源管理器   &lt;leader&gt;t 打开&#x2F;关闭函数列表   &lt;leader&gt;a .h .cpp 文件切换   &lt;leader&gt;u 转到函数声明   &lt;leader&gt;U 转到函数实现   &lt;leader&gt;u 转到变量声明   &amp;lt">
<meta property="og:type" content="article">
<meta property="og:title" content="vimplus快捷键">
<meta property="og:url" content="http://emoh.xyz/2020/06/01/2020-06-01-vimplus%E5%BF%AB%E6%8D%B7%E9%94%AE/index.html">
<meta property="og:site_name" content="Just do it!">
<meta property="og:description" content="插件相关   快捷键 说明    , Leader Key   &lt;leader&gt;n 打开&#x2F;关闭代码资源管理器   &lt;leader&gt;t 打开&#x2F;关闭函数列表   &lt;leader&gt;a .h .cpp 文件切换   &lt;leader&gt;u 转到函数声明   &lt;leader&gt;U 转到函数实现   &lt;leader&gt;u 转到变量声明   &amp;lt">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-06-01T03:29:49.000Z">
<meta property="article:modified_time" content="2020-06-01T03:32:32.660Z">
<meta property="article:author" content="Emoh">
<meta property="article:tag" content="vim">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://emoh.xyz/2020/06/01/2020-06-01-vimplus%E5%BF%AB%E6%8D%B7%E9%94%AE/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>vimplus快捷键 | Just do it!</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Just do it!</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://emoh.xyz/2020/06/01/2020-06-01-vimplus%E5%BF%AB%E6%8D%B7%E9%94%AE/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/touxiang.png">
      <meta itemprop="name" content="Emoh">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Just do it!">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          vimplus快捷键
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2020-06-01 11:29:49 / 修改时间：11:32:32" itemprop="dateCreated datePublished" datetime="2020-06-01T11:29:49+08:00">2020-06-01</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/vim/" itemprop="url" rel="index"><span itemprop="name">vim</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="插件相关"><a href="#插件相关" class="headerlink" title="插件相关"></a>插件相关</h2><table>
<thead>
<tr>
<th>快捷键</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>,</code></td>
<td>Leader Key</td>
</tr>
<tr>
<td><code>&lt;leader&gt;n</code></td>
<td>打开/关闭代码资源管理器</td>
</tr>
<tr>
<td><code>&lt;leader&gt;t</code></td>
<td>打开/关闭函数列表</td>
</tr>
<tr>
<td><code>&lt;leader&gt;a</code></td>
<td>.h .cpp 文件切换</td>
</tr>
<tr>
<td><code>&lt;leader&gt;u</code></td>
<td>转到函数声明</td>
</tr>
<tr>
<td><code>&lt;leader&gt;U</code></td>
<td>转到函数实现</td>
</tr>
<tr>
<td><code>&lt;leader&gt;u</code></td>
<td>转到变量声明</td>
</tr>
<tr>
<td><code>&lt;leader&gt;o</code></td>
<td>打开include文件</td>
</tr>
<tr>
<td><code>&lt;leader&gt;y</code></td>
<td>拷贝函数声明</td>
</tr>
<tr>
<td><code>&lt;leader&gt;p</code></td>
<td>生成函数实现</td>
</tr>
<tr>
<td><code>&lt;leader&gt;w</code></td>
<td>单词跳转</td>
</tr>
<tr>
<td><code>&lt;leader&gt;f</code></td>
<td>搜索~目录下的文件</td>
</tr>
<tr>
<td><code>&lt;leader&gt;F</code></td>
<td>搜索当前目录下的文本</td>
</tr>
<tr>
<td><code>&lt;leader&gt;g</code></td>
<td>显示git仓库提交记录</td>
</tr>
<tr>
<td><code>&lt;leader&gt;G</code></td>
<td>显示当前文件提交记录</td>
</tr>
<tr>
<td><code>&lt;leader&gt;gg</code></td>
<td>显示当前文件在某个commit下的完整内容</td>
</tr>
<tr>
<td><code>&lt;leader&gt;ff</code></td>
<td>语法错误自动修复(FixIt)</td>
</tr>
<tr>
<td><code>&lt;c-p&gt;</code></td>
<td>切换到上一个buffer</td>
</tr>
<tr>
<td><code>&lt;c-n&gt;</code></td>
<td>切换到下一个buffer</td>
</tr>
<tr>
<td><code>&lt;leader&gt;d</code></td>
<td>删除当前buffer</td>
</tr>
<tr>
<td><code>&lt;leader&gt;D</code></td>
<td>删除当前buffer外的所有buffer</td>
</tr>
<tr>
<td><code>vim</code></td>
<td>运行vim编辑器时,默认启动开始页面</td>
</tr>
<tr>
<td><code>&lt;F5&gt;</code></td>
<td>显示语法错误提示窗口</td>
</tr>
<tr>
<td><code>&lt;F9&gt;</code></td>
<td>显示上一主题</td>
</tr>
<tr>
<td><code>&lt;F10&gt;</code></td>
<td>显示下一主题</td>
</tr>
<tr>
<td><code>&lt;leader&gt;l</code></td>
<td>按竖线对齐</td>
</tr>
<tr>
<td><code>&lt;leader&gt;=</code></td>
<td>按等号对齐</td>
</tr>
<tr>
<td><code>Ya</code></td>
<td>复制行文本到字母a</td>
</tr>
<tr>
<td><code>Da</code></td>
<td>剪切行文本到字母a</td>
</tr>
<tr>
<td><code>Ca</code></td>
<td>改写行文本到字母a</td>
</tr>
<tr>
<td><code>rr</code></td>
<td>替换文本</td>
</tr>
<tr>
<td><code>&lt;leader&gt;r</code></td>
<td>全局替换，目前只支持单个文件</td>
</tr>
<tr>
<td><code>rev</code></td>
<td>翻转当前光标下的单词或使用V模式选择的文本</td>
</tr>
<tr>
<td><code>gcc</code></td>
<td>注释代码</td>
</tr>
<tr>
<td><code>gcap</code></td>
<td>注释段落</td>
</tr>
<tr>
<td><code>vif</code></td>
<td>选中函数内容</td>
</tr>
<tr>
<td><code>dif</code></td>
<td>删除函数内容</td>
</tr>
<tr>
<td><code>cif</code></td>
<td>改写函数内容</td>
</tr>
<tr>
<td><code>vaf</code></td>
<td>选中函数内容（包括函数名 花括号）</td>
</tr>
<tr>
<td><code>daf</code></td>
<td>删除函数内容（包括函数名 花括号）</td>
</tr>
<tr>
<td><code>caf</code></td>
<td>改写函数内容（包括函数名 花括号）</td>
</tr>
<tr>
<td><code>fa</code></td>
<td>查找字母a，然后再按f键查找下一个</td>
</tr>
<tr>
<td><code>&lt;leader&gt;e</code></td>
<td>快速编辑~/.vimrc文件</td>
</tr>
<tr>
<td><code>&lt;leader&gt;s</code></td>
<td>重新加载~/.vimrc文件</td>
</tr>
<tr>
<td><code>&lt;leader&gt;vp</code></td>
<td>快速编辑~/.vimrc.custom.plugins文件</td>
</tr>
<tr>
<td><code>&lt;leader&gt;vc</code></td>
<td>快速编辑~/.vimrc.custom.config文件</td>
</tr>
<tr>
<td><code>&lt;leader&gt;h</code></td>
<td>打开vimplus帮助文档</td>
</tr>
<tr>
<td><code>&lt;leader&gt;H</code></td>
<td>打开当前光标所在单词的vim帮助文档</td>
</tr>
<tr>
<td><code>&lt;leader&gt;&lt;leader&gt;t</code></td>
<td>生成try-catch代码块</td>
</tr>
<tr>
<td><code>&lt;leader&gt;&lt;leader&gt;y</code></td>
<td>复制当前选中到系统剪切板</td>
</tr>
<tr>
<td><code>&lt;leader&gt;&lt;leader&gt;i</code></td>
<td>安装插件</td>
</tr>
<tr>
<td><code>&lt;leader&gt;&lt;leader&gt;u</code></td>
<td>更新插件</td>
</tr>
<tr>
<td><code>&lt;leader&gt;&lt;leader&gt;c</code></td>
<td>删除插件</td>
</tr>
</tbody></table>
<a id="more"></a>

<h2 id="插入模式"><a href="#插入模式" class="headerlink" title="插入模式"></a>插入模式</h2><table>
<thead>
<tr>
<th>快捷键</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>i</code></td>
<td>在光标处进入插入模式</td>
</tr>
<tr>
<td><code>I</code></td>
<td>在行首进入插入模式</td>
</tr>
<tr>
<td><code>a</code></td>
<td>在光标后进入插入模式</td>
</tr>
<tr>
<td><code>A</code></td>
<td>在行尾进入插入模式</td>
</tr>
<tr>
<td><code>o</code></td>
<td>在下一行插入新行并进入插入模式</td>
</tr>
<tr>
<td><code>O</code></td>
<td>在上一行插入新行并进入插入模式</td>
</tr>
<tr>
<td><code>gi</code></td>
<td>进入到上一次插入模式的位置</td>
</tr>
<tr>
<td><code>&lt;esc&gt;</code></td>
<td>退出插入模式</td>
</tr>
</tbody></table>
<h2 id="缓存操作"><a href="#缓存操作" class="headerlink" title="缓存操作"></a>缓存操作</h2><table>
<thead>
<tr>
<th>快捷键</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>:e &lt;filename&gt;</code></td>
<td>新建buffer打开文件</td>
</tr>
<tr>
<td><code>:bp</code></td>
<td>切换到上一个buffer</td>
</tr>
<tr>
<td><code>:bn</code></td>
<td>切换到下一个buffer</td>
</tr>
<tr>
<td><code>:bd</code></td>
<td>删除当前buffer</td>
</tr>
</tbody></table>
<h2 id="窗口操作"><a href="#窗口操作" class="headerlink" title="窗口操作"></a>窗口操作</h2><table>
<thead>
<tr>
<th>快捷键</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>:sp &lt;filename&gt;</code></td>
<td>横向切分窗口并打开文件</td>
</tr>
<tr>
<td><code>:vsp &lt;filename&gt;</code></td>
<td>竖向切分窗口并打开文件</td>
</tr>
<tr>
<td><code>&lt;c-w&gt;h</code></td>
<td>跳到左边的窗口</td>
</tr>
<tr>
<td><code>&lt;c-w&gt;j</code></td>
<td>跳到下边的窗口</td>
</tr>
<tr>
<td><code>&lt;c-w&gt;k</code></td>
<td>跳到上边的窗口</td>
</tr>
<tr>
<td><code>&lt;c-w&gt;l</code></td>
<td>跳到右边的窗口</td>
</tr>
<tr>
<td><code>&lt;c-w&gt;c</code></td>
<td>关闭当前窗口</td>
</tr>
<tr>
<td><code>&lt;c-w&gt;o</code></td>
<td>关闭其他窗口</td>
</tr>
<tr>
<td><code>:only</code></td>
<td>关闭其他窗口</td>
</tr>
</tbody></table>
<h2 id="光标移动"><a href="#光标移动" class="headerlink" title="光标移动"></a>光标移动</h2><table>
<thead>
<tr>
<th>快捷键</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>h</code></td>
<td>上下左右移动</td>
</tr>
<tr>
<td><code>j</code></td>
<td>上下左右移动</td>
</tr>
<tr>
<td><code>k</code></td>
<td>上下左右移动</td>
</tr>
<tr>
<td><code>l</code></td>
<td>上下左右移动</td>
</tr>
<tr>
<td><code>0</code></td>
<td>光标移动到行首</td>
</tr>
<tr>
<td><code>^</code></td>
<td>跳到从行首开始第一个非空白字符</td>
</tr>
<tr>
<td><code>$</code></td>
<td>光标移动到行尾</td>
</tr>
<tr>
<td><code>&lt;c-o&gt;</code></td>
<td>跳到上一个位置</td>
</tr>
<tr>
<td><code>&lt;c-i&gt;</code></td>
<td>跳到下一个位置</td>
</tr>
<tr>
<td><code>&lt;c-b&gt;</code></td>
<td>上一页</td>
</tr>
<tr>
<td><code>&lt;c-f&gt;</code></td>
<td>下一页</td>
</tr>
<tr>
<td><code>&lt;c-u&gt;</code></td>
<td>上移半屏</td>
</tr>
<tr>
<td><code>&lt;c-d&gt;</code></td>
<td>下移半屏</td>
</tr>
<tr>
<td><code>H</code></td>
<td>调到屏幕顶上</td>
</tr>
<tr>
<td><code>M</code></td>
<td>调到屏幕中间</td>
</tr>
<tr>
<td><code>L</code></td>
<td>调到屏幕下方</td>
</tr>
<tr>
<td><code>:n</code></td>
<td>跳到第n行</td>
</tr>
<tr>
<td><code>w</code></td>
<td>跳到下一个单词开头(标点或空格分隔的单词)</td>
</tr>
<tr>
<td><code>W</code></td>
<td>跳到下一个单词开头(空格分隔的单词)</td>
</tr>
<tr>
<td><code>e</code></td>
<td>跳到下一个单词尾部(标点或空格分隔的单词)</td>
</tr>
<tr>
<td><code>E</code></td>
<td>跳到下一个单词尾部(空格分隔的单词)</td>
</tr>
<tr>
<td><code>b</code></td>
<td>上一个单词头(标点或空格分隔的单词)</td>
</tr>
<tr>
<td><code>B</code></td>
<td>上一个单词头(空格分隔的单词)</td>
</tr>
<tr>
<td><code>ge</code></td>
<td>上一个单词尾</td>
</tr>
<tr>
<td><code>%</code></td>
<td>在配对符间移动, 可用于()、{}、[]</td>
</tr>
<tr>
<td><code>gg</code></td>
<td>到文件首</td>
</tr>
<tr>
<td><code>G</code></td>
<td>到文件尾</td>
</tr>
<tr>
<td><code>fx</code></td>
<td>跳转到下一个为x的字符</td>
</tr>
<tr>
<td><code>Fx</code></td>
<td>跳转到上一个为x的字符</td>
</tr>
<tr>
<td><code>tx</code></td>
<td>跳转到下一个为x的字符前</td>
</tr>
<tr>
<td><code>Tx</code></td>
<td>跳转到上一个为x的字符前</td>
</tr>
<tr>
<td><code>;</code></td>
<td>跳到下一个搜索的结果</td>
</tr>
<tr>
<td><code>[[</code></td>
<td>跳转到函数开头</td>
</tr>
<tr>
<td><code>]]</code></td>
<td>跳转到函数结尾</td>
</tr>
</tbody></table>
<h2 id="文本编辑"><a href="#文本编辑" class="headerlink" title="文本编辑"></a>文本编辑</h2><table>
<thead>
<tr>
<th>快捷键</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>r</code></td>
<td>替换当前字符</td>
</tr>
<tr>
<td><code>R</code></td>
<td>进入替换模式，直至 ESC 离开</td>
</tr>
<tr>
<td><code>s</code></td>
<td>替换字符（删除光标处字符，并进入插入模式，前可接数量）</td>
</tr>
<tr>
<td><code>S</code></td>
<td>替换行（删除当前行，并进入插入模式，前可接数量）</td>
</tr>
<tr>
<td><code>cc</code></td>
<td>改写当前行（删除当前行并进入插入模式），同 S</td>
</tr>
<tr>
<td><code>cw</code></td>
<td>改写光标开始处的当前单词</td>
</tr>
<tr>
<td><code>ciw</code></td>
<td>改写光标所处的单词</td>
</tr>
<tr>
<td><code>caw</code></td>
<td>改写光标所处的单词，并且包括前后空格（如果有的话）</td>
</tr>
<tr>
<td><code>ct,</code></td>
<td>改写到逗号</td>
</tr>
<tr>
<td><code>c0</code></td>
<td>改写到行首</td>
</tr>
<tr>
<td><code>c^</code></td>
<td>改写到行首（第一个非零字符）</td>
</tr>
<tr>
<td><code>c$</code></td>
<td>改写到行末</td>
</tr>
<tr>
<td><code>C</code></td>
<td>改写到行末（同 c$）</td>
</tr>
<tr>
<td><code>ci&quot;</code></td>
<td>改写双引号中的内容</td>
</tr>
<tr>
<td><code>ci&#39;</code></td>
<td>改写单引号中的内容</td>
</tr>
<tr>
<td><code>ci)</code></td>
<td>改写小括号中的内容</td>
</tr>
<tr>
<td><code>ci]</code></td>
<td>改写中括号中内容</td>
</tr>
<tr>
<td><code>ci}</code></td>
<td>改写大括号中内容</td>
</tr>
<tr>
<td><code>cit</code></td>
<td>改写 xml tag 中的内容</td>
</tr>
<tr>
<td><code>cis</code></td>
<td>改写当前句子</td>
</tr>
<tr>
<td><code>ciB</code></td>
<td>改写’{}’中的内容</td>
</tr>
<tr>
<td><code>c2w</code></td>
<td>改写下两个单词</td>
</tr>
<tr>
<td><code>ct(</code></td>
<td>改写到小括号前</td>
</tr>
<tr>
<td><code>x</code></td>
<td>删除当前字符，前面可以接数字，3x代表删除三个字符</td>
</tr>
<tr>
<td><code>X</code></td>
<td>向前删除字符</td>
</tr>
<tr>
<td><code>dd</code></td>
<td>删除当前行</td>
</tr>
<tr>
<td><code>d0</code></td>
<td>删除到行首</td>
</tr>
<tr>
<td><code>d^</code></td>
<td>删除到行首（第一个非零字符）</td>
</tr>
<tr>
<td><code>d$</code></td>
<td>删除到行末</td>
</tr>
<tr>
<td><code>D</code></td>
<td>删除到行末（同 d$）</td>
</tr>
<tr>
<td><code>dw</code></td>
<td>删除当前单词</td>
</tr>
<tr>
<td><code>dt,</code></td>
<td>删除到逗号</td>
</tr>
<tr>
<td><code>diw</code></td>
<td>删除光标所处的单词</td>
</tr>
<tr>
<td><code>daw</code></td>
<td>删除光标所处的单词，并包含前后空格（如果有的话）</td>
</tr>
<tr>
<td><code>di&quot;</code></td>
<td>删除双引号中的内容</td>
</tr>
<tr>
<td><code>di&#39;</code></td>
<td>删除单引号中的内容</td>
</tr>
<tr>
<td><code>di)</code></td>
<td>删除小括号中的内容</td>
</tr>
<tr>
<td><code>di]</code></td>
<td>删除中括号中内容</td>
</tr>
<tr>
<td><code>di}</code></td>
<td>删除大括号中内容</td>
</tr>
<tr>
<td><code>diB</code></td>
<td>删除’{}’中的内容</td>
</tr>
<tr>
<td><code>dit</code></td>
<td>删除 xml tag 中的内容</td>
</tr>
<tr>
<td><code>dis</code></td>
<td>删除当前句子</td>
</tr>
<tr>
<td><code>d2w</code></td>
<td>删除下两个单词</td>
</tr>
<tr>
<td><code>dt(</code></td>
<td>删除到小括号前</td>
</tr>
<tr>
<td><code>dgg</code></td>
<td>删除到文件头部</td>
</tr>
<tr>
<td><code>dG</code></td>
<td>删除到文件尾部</td>
</tr>
<tr>
<td><code>d}</code></td>
<td>删除下一段</td>
</tr>
<tr>
<td><code>d{</code></td>
<td>删除上一段</td>
</tr>
<tr>
<td><code>u</code></td>
<td>撤销</td>
</tr>
<tr>
<td><code>U</code></td>
<td>撤销整行操作</td>
</tr>
<tr>
<td><code>CTRL-R</code></td>
<td>撤销上一次 u 命令</td>
</tr>
<tr>
<td><code>J</code></td>
<td>连接若干行</td>
</tr>
<tr>
<td><code>gJ</code></td>
<td>连接若干行，删除空白字符</td>
</tr>
<tr>
<td><code>.</code></td>
<td>重复上一次操作</td>
</tr>
<tr>
<td><code>~</code></td>
<td>交换大小写</td>
</tr>
<tr>
<td><code>g~iw</code></td>
<td>替换当前单词的大小写</td>
</tr>
<tr>
<td><code>gUiw</code></td>
<td>将单词转成大写</td>
</tr>
<tr>
<td><code>guiw</code></td>
<td>将当前单词转成小写</td>
</tr>
<tr>
<td><code>guu</code></td>
<td>全行转为小写</td>
</tr>
<tr>
<td><code>gUU</code></td>
<td>全行转为大写</td>
</tr>
<tr>
<td><code>gg=G</code></td>
<td>缩进整个文件</td>
</tr>
<tr>
<td><code>=a{</code></td>
<td>缩进光标所在代码块</td>
</tr>
<tr>
<td><code>=i{</code></td>
<td>缩进光标所在代码块，不缩进”{“</td>
</tr>
<tr>
<td><code>&lt;&lt;</code></td>
<td>减少缩进</td>
</tr>
<tr>
<td><code>&gt;&gt;</code></td>
<td>增加缩进</td>
</tr>
<tr>
<td><code>==</code></td>
<td>自动缩进</td>
</tr>
<tr>
<td><code>CTRL-A</code></td>
<td>增加数字</td>
</tr>
<tr>
<td><code>CTRL-X</code></td>
<td>减少数字</td>
</tr>
<tr>
<td><code>p</code></td>
<td>粘贴到光标后</td>
</tr>
<tr>
<td><code>P</code></td>
<td>粘贴到光标前</td>
</tr>
<tr>
<td><code>v</code></td>
<td>开始标记</td>
</tr>
<tr>
<td><code>y</code></td>
<td>复制标记内容</td>
</tr>
<tr>
<td><code>V</code></td>
<td>开始按行标记</td>
</tr>
<tr>
<td><code>CTRL-V</code></td>
<td>开始列标记</td>
</tr>
<tr>
<td><code>y$</code></td>
<td>复制当前位置到本行结束的内容</td>
</tr>
<tr>
<td><code>yy</code></td>
<td>复制当前行</td>
</tr>
<tr>
<td><code>Y</code></td>
<td>复制当前行，同 yy</td>
</tr>
<tr>
<td><code>yt,</code></td>
<td>复制到逗号</td>
</tr>
<tr>
<td><code>yiw</code></td>
<td>复制当前单词</td>
</tr>
<tr>
<td><code>&quot;+y</code></td>
<td>复制当前选中到系统剪切板</td>
</tr>
<tr>
<td><code>3yy</code></td>
<td>复制光标下三行内容</td>
</tr>
<tr>
<td><code>v0</code></td>
<td>选中当前位置到行首</td>
</tr>
<tr>
<td><code>v$</code></td>
<td>选中当前位置到行末</td>
</tr>
<tr>
<td><code>vt,</code></td>
<td>选中到逗号</td>
</tr>
<tr>
<td><code>viw</code></td>
<td>选中当前单词</td>
</tr>
<tr>
<td><code>vi)</code></td>
<td>选中小括号内的东西</td>
</tr>
<tr>
<td><code>vi]</code></td>
<td>选中中括号内的东西</td>
</tr>
<tr>
<td><code>viB</code></td>
<td>选中’{}’中的内容</td>
</tr>
<tr>
<td><code>vis</code></td>
<td>选中句子中的东西</td>
</tr>
<tr>
<td><code>gv</code></td>
<td>重新选择上一次选中的文字</td>
</tr>
<tr>
<td><code>:set paste</code></td>
<td>允许粘贴模式（避免粘贴时自动缩进影响格式）</td>
</tr>
<tr>
<td><code>:set nopaste</code></td>
<td>禁止粘贴模式</td>
</tr>
<tr>
<td><code>&quot;?yy</code></td>
<td>复制当前行到寄存器 ? ，问号代表 0-9 的寄存器名称</td>
</tr>
<tr>
<td><code>&quot;?p</code></td>
<td>将寄存器 ? 的内容粘贴到光标后</td>
</tr>
<tr>
<td><code>&quot;?P</code></td>
<td>将寄存器 ? 的内容粘贴到光标前</td>
</tr>
<tr>
<td><code>:registers</code></td>
<td>显示所有寄存器内容</td>
</tr>
<tr>
<td><code>:[range]y</code></td>
<td>复制范围，比如 :20,30y 是复制20到30行，:10y 是复制第十行</td>
</tr>
<tr>
<td><code>:[range]d</code></td>
<td>删除范围，比如 :20,30d 是删除20到30行，:10d 是删除第十行</td>
</tr>
<tr>
<td><code>ddp</code></td>
<td>交换两行内容：先删除当前行复制到寄存器，并粘贴</td>
</tr>
</tbody></table>
<h2 id="文件操作"><a href="#文件操作" class="headerlink" title="文件操作"></a>文件操作</h2><table>
<thead>
<tr>
<th>快捷键</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>:w</code></td>
<td>保存文件</td>
</tr>
<tr>
<td><code>:w &lt;filename&gt;</code></td>
<td>按名称保存文件</td>
</tr>
<tr>
<td><code>ZZ</code></td>
<td>保存文件（如果有改动的话），并关闭窗口</td>
</tr>
<tr>
<td><code>:e &lt;filename&gt;</code></td>
<td>打开文件并编辑</td>
</tr>
<tr>
<td><code>:saveas &lt;filename&gt;</code></td>
<td>另存为文件</td>
</tr>
<tr>
<td><code>:r &lt;filename&gt;</code></td>
<td>读取文件并将内容插入到光标后</td>
</tr>
<tr>
<td><code>:r !dir</code></td>
<td>将dir命令的输出捕获并插入到光标后</td>
</tr>
<tr>
<td><code>:close</code></td>
<td>关闭文件</td>
</tr>
<tr>
<td><code>:q</code></td>
<td>退出</td>
</tr>
<tr>
<td><code>:q!</code></td>
<td>强制退出</td>
</tr>
<tr>
<td><code>:wa</code></td>
<td>保存所有文件</td>
</tr>
<tr>
<td><code>:cd &lt;path&gt;</code></td>
<td>切换Vim当前路径</td>
</tr>
<tr>
<td><code>:new</code></td>
<td>打开一个新的窗口编辑新文件</td>
</tr>
<tr>
<td><code>:enew</code></td>
<td>在当前窗口创建新文件</td>
</tr>
<tr>
<td><code>:vnew</code></td>
<td>在左右切分的新窗口中编辑新文件</td>
</tr>
<tr>
<td><code>:tabnew</code></td>
<td>在新的标签页中编辑新文件</td>
</tr>
</tbody></table>
<h2 id="使用外部程序"><a href="#使用外部程序" class="headerlink" title="使用外部程序"></a>使用外部程序</h2><table>
<thead>
<tr>
<th>快捷键</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>!</code></td>
<td>告诉vim正在执行一个过滤操作</td>
</tr>
<tr>
<td><code>!5Gsort&lt;Enter&gt;</code></td>
<td>使用外部sort命令对1-5行文本排序</td>
</tr>
<tr>
<td><code>!!</code></td>
<td>对当前行执行过滤命令</td>
</tr>
<tr>
<td><code>!!date&lt;Enter&gt;</code></td>
<td>用”date”的输出代替当前行</td>
</tr>
</tbody></table>
<h2 id="宏录制"><a href="#宏录制" class="headerlink" title="宏录制"></a>宏录制</h2><table>
<thead>
<tr>
<th>快捷键</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>qa</code></td>
<td>开始录制名字为a的宏</td>
</tr>
<tr>
<td><code>q</code></td>
<td>结束录制宏</td>
</tr>
<tr>
<td><code>@a</code></td>
<td>播放名字为a的宏</td>
</tr>
<tr>
<td><code>100@a</code></td>
<td>播放名字为a的宏100次</td>
</tr>
<tr>
<td><code>:normal@a</code></td>
<td>播放名字为a的宏直到自动结束</td>
</tr>
</tbody></table>
<h2 id="实用命令"><a href="#实用命令" class="headerlink" title="实用命令"></a>实用命令</h2><table>
<thead>
<tr>
<th>快捷键</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>/pattern</code></td>
<td>从光标处向文件尾搜索 pattern</td>
</tr>
<tr>
<td><code>?pattern</code></td>
<td>从光标处向文件头搜索 pattern</td>
</tr>
<tr>
<td><code>n</code></td>
<td>向同一方向执行上一次搜索</td>
</tr>
<tr>
<td><code>N</code></td>
<td>向相反方向执行上一次搜索</td>
</tr>
<tr>
<td><code>*</code></td>
<td>向前搜索光标下的单词</td>
</tr>
<tr>
<td><code>#</code></td>
<td>向后搜索光标下的单词</td>
</tr>
<tr>
<td><code>:s/p1/p2/g</code></td>
<td>替换当前行的p1为p2</td>
</tr>
<tr>
<td><code>:%s/p1/p2/g</code></td>
<td>替换当前文件中的p1为p2</td>
</tr>
<tr>
<td><code>:%s/&lt;p1&gt;/p2/g</code></td>
<td>替换当前文件中的p1单词为p2</td>
</tr>
<tr>
<td><code>:%s/p1/p2/gc</code></td>
<td>替换当前文件中的p1为p2，并且每处询问你是否替换</td>
</tr>
<tr>
<td><code>:10,20s/p1/p2/g</code></td>
<td>将第10到20行中所有p1替换为p2</td>
</tr>
<tr>
<td><code>:%s/1\\2\/3/123/g</code></td>
<td>将“1\2/3” 替换为 “123”（特殊字符使用反斜杠标注）</td>
</tr>
<tr>
<td><code>:%s/\r//g</code></td>
<td>删除 DOS 换行符 ^M</td>
</tr>
<tr>
<td><code>:g/^\s*$/d</code></td>
<td>删除空行</td>
</tr>
<tr>
<td><code>:g/test/d</code></td>
<td>删除所有包含 test 的行</td>
</tr>
<tr>
<td><code>:v/test/d</code></td>
<td>删除所有不包含 test 的行</td>
</tr>
<tr>
<td><code>:%s/^/test/</code></td>
<td>在行首加入特定字符(也可以用宏录制来添加)</td>
</tr>
<tr>
<td><code>:%s/$/test/</code></td>
<td>在行尾加入特定字符(也可以用宏录制来添加)</td>
</tr>
<tr>
<td><code>:sort</code></td>
<td>排序</td>
</tr>
<tr>
<td><code>:g/^\(.\+\)$\n\1/d</code></td>
<td>去除重复行(先排序)</td>
</tr>
<tr>
<td><code>:%s/^.\{10\}//</code></td>
<td>删除每行前10个字符</td>
</tr>
<tr>
<td><code>:%s/.\{10\}$//</code></td>
<td>删除每行尾10个字符</td>
</tr>
</tbody></table>
<h2 id="帮助"><a href="#帮助" class="headerlink" title="帮助"></a>帮助</h2><table>
<thead>
<tr>
<th>快捷键</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>h tutor</code></td>
<td>入门文档</td>
</tr>
<tr>
<td><code>h quickref</code></td>
<td>快速帮助</td>
</tr>
<tr>
<td><code>h index</code></td>
<td>查询Vim所有键盘命令定义</td>
</tr>
<tr>
<td><code>h summary</code></td>
<td>帮助你更好的使用内置帮助系统</td>
</tr>
<tr>
<td><code>h pattern.txt</code></td>
<td>正则表达式帮助</td>
</tr>
<tr>
<td><code>h eval</code></td>
<td>脚本编写帮助</td>
</tr>
<tr>
<td><code>h function-list</code></td>
<td>查看VimScript的函数列表</td>
</tr>
<tr>
<td><code>h windows.txt</code></td>
<td>窗口使用帮助</td>
</tr>
<tr>
<td><code>h tabpage.txt</code></td>
<td>标签页使用帮助</td>
</tr>
<tr>
<td><code>h tips</code></td>
<td>查看Vim内置的常用技巧文档</td>
</tr>
<tr>
<td><code>h quote</code></td>
<td>寄存器</td>
</tr>
<tr>
<td><code>h autocommand-events</code></td>
<td>所有可能事件</td>
</tr>
<tr>
<td><code>h write-plugin</code></td>
<td>编写插件</td>
</tr>
</tbody></table>
<h2 id="其他"><a href="#其他" class="headerlink" title="其他"></a>其他</h2><table>
<thead>
<tr>
<th>快捷键</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>vim -u NONE -N</code></td>
<td>开启vim时不加载vimrc文件</td>
</tr>
<tr>
<td><code>vimdiff file1 file2</code></td>
<td>显示文件差异</td>
</tr>
<tr>
<td><code>vim -R filename</code></td>
<td>以只读方式打开（阅读模式）</td>
</tr>
</tbody></table>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/vim/" rel="tag"># vim</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/05/29/2020-05-29-awk%E5%92%8Cash/" rel="prev" title="awk和ash">
      <i class="fa fa-chevron-left"></i> awk和ash
    </a></div>
      <div class="post-nav-item">
    <a href="/2020/06/01/2020-06-01-tmux%E5%BF%AB%E6%8D%B7%E9%94%AE/" rel="next" title="tmux快捷键">
      tmux快捷键 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#插件相关"><span class="nav-number">1.</span> <span class="nav-text">插件相关</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#插入模式"><span class="nav-number">2.</span> <span class="nav-text">插入模式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#缓存操作"><span class="nav-number">3.</span> <span class="nav-text">缓存操作</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#窗口操作"><span class="nav-number">4.</span> <span class="nav-text">窗口操作</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#光标移动"><span class="nav-number">5.</span> <span class="nav-text">光标移动</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#文本编辑"><span class="nav-number">6.</span> <span class="nav-text">文本编辑</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#文件操作"><span class="nav-number">7.</span> <span class="nav-text">文件操作</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用外部程序"><span class="nav-number">8.</span> <span class="nav-text">使用外部程序</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#宏录制"><span class="nav-number">9.</span> <span class="nav-text">宏录制</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#实用命令"><span class="nav-number">10.</span> <span class="nav-text">实用命令</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#帮助"><span class="nav-number">11.</span> <span class="nav-text">帮助</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#其他"><span class="nav-number">12.</span> <span class="nav-text">其他</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Emoh"
      src="/images/touxiang.png">
  <p class="site-author-name" itemprop="name">Emoh</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">29</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">16</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">23</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Emoh</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  

</body>
</html>
